package com.ymttest.business.service.shenqi;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;

import com.ymatou.iapi.counter.parameter.SetNaturalBean;
import com.ymatou.iapi.counter.service.SetNaturalCall;
import com.ymttest.utils.YMTDateUtil;

public class CounterService {
	
	/**
	 * 风控设置一个月付款金额上限
	 * @throws IOException 
	 * @throws ClientProtocolException 
	 */
	public static void setUserPaidAmountSum(int value, String mchNo) throws ClientProtocolException, IOException {
		SetNaturalBean setNaturalBean = new SetNaturalBean();
		SetNaturalCall setNaturalCall = new SetNaturalCall();
		
		setNaturalBean.setAction(1);
		setNaturalBean.setAppId("shenqiriskcontrol");
		setNaturalBean.setCounter("UserPaidAmountSum");
		setNaturalBean.setDataTime(YMTDateUtil.getBeforeOrNextDay(-10, YMTDateUtil.YMDTHMS_STRING));
//		setNaturalBean.setTargetId(25894592 + "WC5c78d78282173UserPaidAmountSum");
		setNaturalBean.setTargetId(25894592 + mchNo + "UserPaidAmountSum");
		setNaturalBean.setValue(value);
		
		setNaturalCall.setData(setNaturalBean);
		setNaturalCall.callService();
	}
	
	/**
	 * 风控设置一天付款笔数上限
	 * @throws IOException 
	 * @throws ClientProtocolException 
	 */
	public static void setUserPaidCounter(int value, String mchNo) throws ClientProtocolException, IOException {
		SetNaturalBean setNaturalBean = new SetNaturalBean();
		SetNaturalCall setNaturalCall = new SetNaturalCall();
		
		setNaturalBean.setAction(1);
		setNaturalBean.setAppId("shenqiriskcontrol");
		setNaturalBean.setCounter("UserPaidCounter");
		setNaturalBean.setDataTime(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMDTHMS_STRING));
//		setNaturalBean.setTargetId(25894592 + "WC5c78d78282173UserPaidCounter");
		setNaturalBean.setTargetId(25894592 + mchNo + "UserPaidCounter");
		setNaturalBean.setValue(value);
		
		setNaturalCall.setData(setNaturalBean);
		setNaturalCall.callService();
	}
}
